<?php

/**
 * Created by PhpStorm.
 * User: ls721
 * Date: 2016/10/27 0027
 * Time: 16:24
 */
class Domain_Response
{

    public function listResponse($doctor_id)
    {
        $model = new Model_Response();
        return $model->listResponse($doctor_id);
    }

    public function getResponse($response_id)
    {
        $model = new Model_Response();
        $rs1 =  $model->getResponseSingle($response_id);
        $model_Event = new Model_Event();
        $rs2 = $model_Event->getEventInfo($rs1["EventId"]);
        return array_merge($rs2, $rs1);
    }
    public function listDoctorOfResponse($event_id,$lng,$lat)
    {
        $model = new Model_Response();
        $rs = $model->listDoctorOfResponse($event_id);
        $domain=new Domain_Doctor();
        // array_splice($rs,1,1);
        $i = 0;
        for ($i=0;$i<count($rs);$i++) {
            $value= $rs[$i];
            $dis=$domain->getDistance($lng, $lat, $value['Lng'], $value['Lat']);
            $value["Distance"]=$dis;

            if($value["Status"]=='0'){$value["Status"]="未应答";}
            if($value["Status"]=='1'){$value["Status"]="已应答";}
            if($value["DoctorStatus"]=='0'){$value["DoctorStatus"]="可呼叫";}
            if($value["DoctorStatus"]=='1'){$value["DoctorStatus"]="正忙";}
            $rs[$i]=$value;
//            if($value["Visible"]=='0'){$value["Visible"]="不可定位";}
//            if($value["Visible"]=='1'){$value["Visible"]="可定位";}


        }
        //var_dump($model->listDoctors());
        return $rs;
    }
}